@extends('admin::layouts.master')
@section('title')
    保养订单
@endsection
@section('tab')

    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-tab">
                    <ul class="layui-tab-title">
                        <li data-status="" @if($arr_search['status']=='') class="layui-this" @endif>全部订单</li>
                        <li data-status="1" @if($arr_search['status']==1) class="layui-this" @endif>待支付订单</li>
                        <li data-status="2" @if($arr_search['status']==2) class="layui-this" @endif>待处理订单
                            @if($d_num > 0) <span class="layui-badge layui-bg-green">{{$d_num}}</span> @endif
                        </li>
                        <li data-status="3" @if($arr_search['status']==3) class="layui-this" @endif>申请退款订单
                            @if($t_num > 0) <span class="layui-badge layui-bg-orange">{{$t_num}}</span> @endif
                        </li>
                        <li data-status="4" @if($arr_search['status']==4) class="layui-this" @endif>已退款订单</li>
                        <li data-status="5" @if($arr_search['status']==5) class="layui-this" @endif>已取消订单</li>
                    </ul>
                </div>
                <div class="layui-card">
                    <div class="layui-card-body">
                        <form class="layui-form layui-col-space5">
                            <div class="layui-input-inline layui-show-xs-block" style="width: 200px; ">
                                <input type="text" name="order_number" placeholder="订单编号"
                                       value="{{$arr_search['order_number']}}" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-input-inline">
                                <input type="text" name="range" class="layui-input" id="range" value="{{$arr_search['range']}}" placeholder=" 下单日期范围 " autocomplete="off" readonly>
                            </div>
                            <input type="hidden" name="status" id="status" value="{{$arr_search['status']}}">
                            <div class="layui-input-inline layui-show-xs-block">
                                <button class="layui-btn" lay-submit="" lay-filter="sreach">
                                    <i class="layui-icon">&#xe615;</i></button>
                                <a class="layui-btn layui-btn-small"
                                   onclick="location.reload()" title="刷新">
                                    <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
                                </a>
                                @if(!empty($data))
                                    <a id ="export" class="layui-btn layui-btn-small">导出</a>
                                @endif
                            </div>
                        </form>
                    </div>
                    <div class="layui-card-body layui_overflow_y">
                        <table class="layui-table layui-form">
                            <thead>
                            <tr>
                                <th style="min-width: 40px">编号</th>
                                <th>订单编号</th>
                                <th>保养名称</th>
                                <th>订单金额</th>
                                <th>优惠金额</th>
                                <th>支付金额</th>
                                <th>订单状态</th>
                                <th>下单时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($data as $key=>$value)
                                <tr>
                                    <td style="min-width: 40px">{{ $value['id'] }}</td>
                                    <td>{{$value['order_number']}}</td>
                                    <td>{{$value['goods_name']}}</td>
                                    <td>{{$value['order_price']}}</td>
                                    <td>{{$value['coupon_price']}}</td>
                                    <td>{{$value['pay_price']}}</td>
                                    <td>{{ $value['order_status']}}</td>
                                    <td>{{$value['created_at']}}</td>
                                    <td>
                                        <a title="订单详情"
                                           onclick="xadmin.open('订单详情','{{route('admin_order_repairstore_detail',['id'=>$value['id']])}}')"
                                           href="javascript:;">
                                            详情
                                        </a>
                                        <a title="删除" class="ajax_member_del"
                                           data-href="{{route('admin_order_repairstore_del',['id'=>$value['id']])}}"
                                           data-title="确定删除吗？请谨慎操作" href="javascript:;">
                                            删除
                                        </a>
                                    </td>
                                </tr>
                            @endforeach
                            @if(empty($data))
                                <td colspan="66" align="center">暂无数据</td>
                            @endif
                            </tbody>
                        </table>
                    </div>
                    <div class="layui-card-body ">
                        <div class="page">
                            {{$page_link}}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

@endsection

@section('tab_js')
    <script type="text/javascript">
        $(document).on('click', '.layui-tab-title li', function () {
            var status = '?status=' + $(this).attr('data-status');
            location_redirect('admin-maintain-order-list' + status);
        });
        $(document).on('click', '#export', function () {
            location_redirect('admin-export-repair-order' + window.location.search);
        });
        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({elem: '#range', range: true});
        });
    </script>
@endsection




